<template>
    <div class="add">
        <van-field placeholder="请输入用户名" v-model="username" />
        <van-field placeholder="请输入密码" v-model="password" />
        <van-field placeholder="请输入昵称" v-model="nickname" />
        <div style="margin-left: 140px;">
            <van-button @click="Wc">
                注册完成
            </van-button>
        </div>
    </div>
</template>

<script>
import axios from "axios";
export default {
    data() {
        return {
            username: "",
            password: "",
            nickname: "",
        };
    },
    methods: {
        //完成后跳转
        async Wc() {
            await axios
                .post("/zhuce", {
                    username: this.username,
                    password: this.password,
                    nickname: this.nickname,
                })
                .then((res) => {
                    if (res) {
                        alert("注册成功");
                    }
                    console.log(res.data);
                    //跳转登录页面
                    this.$router.push("/login");
                });
        },
    },
};
</script>

<style></style>
